﻿@using Utils;
@model WebUI.Models.JobPostingPreviewViewModel
@{
    ViewBag.Title = "Preview your job - JuicyBasket";
    Layout = "~/Views/Shared/_SiteLayout.cshtml";
}

@section BodyHeaderContent
{
    <div id="header" class="relativetop">
        <div id="header-inner">
            <div class="fl jobtoolbar">
                <h1>Preview Your Listing</h1>
            </div>
            <div class="fr jobtoolbar">
                <a class="gray-submit" href="@Model.GobackUrl">← Go back to edit</a>
                @if (Model.IsValidPage)
                {
                <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <a class="blue-submit" href="@Model.PaymentUrl">Continue to pay →</a>
                }
            </div>
        </div>
    </div>
}
@section BodyFooterContent
{
    <div id="header" class="fixedbottom">
        <div id="header-inner">
            <div class="fl jobtoolbar">
                <h1>Preview Your Listing</h1>
            </div>
            <div class="fr jobtoolbar">
                <a class="gray-submit" href="@Model.GobackUrl">← Go back to edit</a>
                @if (Model.IsValidPage)
                {
                <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <a class="blue-submit" href="@Model.PaymentUrl">Continue to pay →</a>
                }
            </div>
        </div>
    </div>
}

@if (!Model.IsValidPage)
{ 
    <div class="null-message">
	    <h2>You have no job to preview, please click "Go back" link to create a job listing first</h2>
    </div>
}
else
{
<div class="mainSection">
    <div class="clear"></div>
    <div class="mainCol jobpreview">
        <div class="jobprofile">
            <div class="left">
                <a href="@Model.Co.CoUrl" target="_blank"><img src="@Url.StaticFile(Model.AvatarUrl)" alt="logo" class="avatar80"/></a>
            </div>
            <div class="right">
                <h1 class="title">
                    <a href="/jobs/@Model.Job.JobID">@Model.Job.Title.ToUpperAllFirstLetter()</a>
                </h1>
                <div class="company">
                    <a href="@Model.Co.CoUrl" target="_blank">@Model.Co.Name</a> -
                    <em>@Model.Job.Location
                    @if (Model.Job.RelocationOffered)
                    { 
                        @:- Relocation assistance offered
                    }
                    @if (Model.Job.AllowTelecommute)
                    { 
                        @:- Telecommute opportunity
                    }
                    </em>
                </div>
                <div class="smallspacer"></div>
                <ol class="tags">
                    @foreach (var keyword in Model.Job.JobKeywordList)
                    { 
                        <li><a href="/jobs/tag/@keyword">@keyword</a></li>
                    }
                </ol>
            </div>
        </div>

        <div class="spacer"></div>
        <div class="richhtml">
            @Html.Raw(Model.Job.Description)
        </div>
        @if (!string.IsNullOrEmpty(Model.Job.Perk))
        {
            <div class="jobtextblock">
                <div class="title perktitle">Job Perks</div>
                @Model.Job.Perk
            </div>
        }
        @if (!string.IsNullOrEmpty(Model.Co.Description))
        {
            <div class="jobtextblock richhtml">
                <div class="title">Company Description</div>
                @Html.Raw(Model.Co.Description)
            </div>
        }
        <div class="jobtextblock">
            <div class="title">Additional Information</div>
            <div class="job-ai">
                <div class="left">Posted:</div>
                <div class="right">@Model.Job.CreateDate.ToDateTimeString()</div>
            </div>
            <div class="clear"></div>
            <div class="job-ai">
                <div class="left">Type:</div>
                <div class="right">@Model.Job.JobType</div>
            </div>
            <div class="clear"></div>
            <div class="job-ai">
                <div class="left">Experience:</div>
                <div class="right">@Model.Job.JobExp</div>
            </div>
            <div class="clear"></div>
            @if (!string.IsNullOrEmpty(Model.Job.Compensation))
            {
            <div class="job-ai">
                <div class="left">Compensation:</div>
                <div class="right">@Model.Job.Compensation</div>
            </div>
            }
        </div>

        <div class="jobtextblock">
            <div class="title">How to apply</div>
            @if (Model.Job.ApplyViaEmail)
            {
                <div>
                    Contact <a href="mailto:@Model.Job.ApplyEmail">@Model.Job.ApplyEmail</a>. 
                </div>
            
            }
            else
            { 
                <div>Apply via <a href="@Model.Job.ApplyUrl">@Model.Job.ApplyUrl</a></div>
            }
            <div class="richhtml">
                <ul>
                    @if (Model.Job.OnlinePortfolioRequired)
                    { 
                        <li>Online portfolio required</li>
                    }
                    @if (Model.Job.OnlinePDFResumeRequired)
                    { 
                        <li>Online text/pdf resume required</li>
                    }
                </ul>
            </div>
        </div>
    </div>
    <div class="sideCol">
        <div class="jobshare">
            <a class="email" href="mailto:@Model.ShareToFriendUrl">mail to a friend</a>
            <a class="save" href="">save this job</a>
            <a class="twitter" href="@Model.ShareToTwitterUrl">tweet this job</a>
            <a class="facebook" href="@Model.ShareToFacebookUrl">share this job on facebook</a>
        </div>
    </div>
    <div class="clear"></div>
    <div class="largespacer"></div>
</div>
}

@section FooterContent
{
    <script type="text/javascript">
        $(function () {
            var html = '<div id="lightbox-white" style="overflow: auto; "></div>';
            $("body").append(html);
        })
        
    </script>
}
